#include <stdio.h>
#include <string.h>

int isA(char c) { return (int)(c >= 'a' && c <= 'z') + (c >= 'A' && c <= 'Z'); }

int main() {
    char stc[200];
    scanf("%[^\n]", stc);
    int len = strlen(stc), sta = -1;
    for (int i = 0; i <= len; i++) {
        if (isA(stc[i]) && sta == -1) {
            sta = i;
        } else if (!isA(stc[i])) {
            if (sta != -1) {
                for (int j = i - 1; j >= sta; j--)
                    printf("%c", stc[j]);
            }
            sta = -1;
            if (stc[i] == 0) continue;
            printf("%c", stc[i]);
        }
    }
}